package com.feeyin.radar.crm.dao.impl;

import com.feeyin.radar.crm.dao.SystemFileDAO;
import com.feeyin.radar.crm.model.SystemFile;
import java.util.List;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class SystemFileDAOImpl extends SqlMapClientDaoSupport
  implements SystemFileDAO
{
  public List getSystemFilesByRelatedId(Integer relatedId)
  {
    if (relatedId == null) return null;
    SystemFile systemFile = new SystemFile();
    systemFile.setRelatedId(relatedId);
    return getSqlMapClientTemplate().queryForList("getSystemFileByDynamic", systemFile);
  }

  public SystemFile getSystemFile(Integer id) {
    if (id == null) return null;
    SystemFile systemFile = new SystemFile();
    systemFile.setId(id);
    return (SystemFile)getSqlMapClientTemplate().queryForObject("getSystemFileByDynamic", systemFile);
  }

  public boolean insertSystemFile(SystemFile systemFile) {
    Integer result = (Integer)getSqlMapClientTemplate().insert("insertSystemFile", systemFile);
    return result != null;
  }

  public boolean deleteSystemFile(Integer id)
  {
    Integer result = Integer.valueOf(getSqlMapClientTemplate().delete("deleteSystemFile", id));
    return result != null;
  }
}